package me.zhengjie.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import me.zhengjie.annotation.rest.AnonymousPostMapping;
import me.zhengjie.pojo.*;
import me.zhengjie.service.CourseResultService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.parameters.P;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 描述
 *
 * @Author xulitao
 * @Date 2022/3/7
 * @Version 1.0
 */
@RestController
@RequestMapping("/edu")
@CrossOrigin
@Api("教育模块")
public class EduPlatController {

    @Autowired
    private CourseResultService courseResultService;

    @AnonymousPostMapping("/queryStuScore")
    @ApiOperation("查询学生成绩")
    public Object queryStuScore(@RequestBody StuScoreVo vo) {
        PageVo pageVo = courseResultService.queryList(vo);
        return pageVo;
    }

    @AnonymousPostMapping("/getAllStu")
    @ApiOperation("查询全部学生")
    public Object getAllStu() {
        Map<String,Object> paramMap = new HashMap<>();
        paramMap.put("data",courseResultService.queryStu());
        paramMap.put("code",200);
        paramMap.put("mgs","success");
        return paramMap;
    }

    @AnonymousPostMapping("/insertStuScore")
    @ApiOperation("录入学生成绩")
    public Object insertStuScore(@RequestBody List<CourseResultEntity> list) {
        return courseResultService.insertStuScore(list);
    }

    @AnonymousPostMapping("/getAllSubject")
    @ApiOperation("获取全部学科")
    public ResultVo getAllSubject() {
        return courseResultService.getAllSubject();
    }

    @AnonymousPostMapping("/updateStuScore")
    @ApiOperation("更新学生成绩")
    public ResultVo updateStuScore(@RequestBody CourseResultEntity entity) {
        return courseResultService.updateStuScore(entity);
    }

    @AnonymousPostMapping("/delStuScore")
    @ApiOperation("删除学生成绩")
    public ResultVo delStuScore(@RequestBody CourseResultEntity entity) {
        return courseResultService.delStuScore(entity);
    }

    @AnonymousPostMapping("/insertWorkFinish")
    @ApiOperation("进行作业布置")
    public ResultVo insertWorkFinish(@RequestBody List<WordFinishVo> list) {
        return courseResultService.insertWorkFinish(list);
    }

    @AnonymousPostMapping("/updateWorkFinish")
    @ApiOperation("更新布置作业")
    public ResultVo updateWorkFinish(@RequestBody WordFinishVo entity) {
        return courseResultService.updateWorkFinish(entity);
    }

    @AnonymousPostMapping("/delWorkFinish")
    @ApiOperation("删除作业布置")
    public ResultVo delWorkFinish(@RequestBody WordFinishVo entity) {
        return courseResultService.delWorkFinish(entity);
    }


    @AnonymousPostMapping("/insertPlayStation")
    @ApiOperation("互动情况入库")
    public ResultVo insertPlayStation(@RequestBody List<AskAnswerVo> list) {
        return courseResultService.insertPlayStation(list);
    }

    @AnonymousPostMapping("/updatePlayStation")
    @ApiOperation("更新互动情况")
    public ResultVo updatePlayStation(@RequestBody AskAnswerVo entity) {
        return courseResultService.updatePlayStation(entity);
    }

    @AnonymousPostMapping("/delPlayStation")
    @ApiOperation("删除互动情况")
    public ResultVo delPlayStation(@RequestBody AskAnswerVo entity) {
        return courseResultService.delPlayStation(entity);
    }

    @AnonymousPostMapping("/queryPlayStation")
    @ApiOperation("查询互动情况")
    public PageVo<AskAnswerEntity> getPlayStation(@RequestBody AskAnswerVo entity) {
        return courseResultService.getPlayStation(entity);
    }

    @AnonymousPostMapping("/getWorkFinish")
    @ApiOperation("查询作业布置情况")
    public PageVo<WorkFinishEntity> getWorkFinish(@RequestBody WordFinishVo entity) {
        return courseResultService.getWorkFinish(entity);
    }

}
